<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">按钮</button>
    <script>
        function $(selector) {
            return document.querySelector(selector)
        }

        function $$(selector) {
            return document.querySelectorAll(selector)
        }
    </script>
    <script>
        var btn = $('#btn');
        // btn.事件属性 = 匿名函数
        // btn.onclick = function()
		/*
        btn.onclick = function() {
			alert("ok")
		}*/
		
		/*
		标签对象.addEventListener(事件名,事件的处理程序)
		
		*/
		btn.addEventListener('click',function() {
			alert('事件的处理程序');
		})
    </script>
</body>
</html>